09. 练习:爱上子查询

更多的子查询练习
以上是数据库的 ERD,当你处理下面的练习时,可能会用到该 ERD。你应该将答案写成子查询,而不是得出一个答案并复制输出。这么做的重要性是能够让查询动态地回答问题,即使数据变化了,依然能获得正确的答案。
-
提供每个 区域 销售额 ( total_amt_usd ) 最高的 销售代表 的 姓名 。
-
对于具有最高销售额 ( total_amt_usd ) 的区域,总共下了多少个订单 ( total count orders) ?
-
对于购买标准纸张数量 ( standard_qty ) 最多的客户(在作为客户的整个时期内), 有多少客户 的购买总数依然更多?
-
对于(在作为客户的整个时期内)总消费 ( total_amt_usd ) 最多的客户,他们在每个渠道上有多少 web_events ?
-
对于总消费前十名的客户,他们的平均终身消费 ( total_amt_usd ) 是多少?
-
比客户的平均每订单消费高的企业,它们的平均终身消费 ( total_amt_usd ) 是多少?
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: sql-evaluator
- Opened files (when workspace is loaded): n/a